package top.whysu.edevice.utils;

import cn.hutool.crypto.symmetric.RC4;

import java.util.Random;

/**
 * 邀请码，生成六位随机数
 */
public class ShareCodeUtil {

    public static String generateCode() {
        // 去掉了字母I和数字1
        String charList = "ABCDEFGHJKLMNPQRSTUVWXY";
        String numList = "023456789";
        String rev = "";
        int maxNumCount = 4;
        int length = 6;
        Random f = new Random();
        for (int i = 0; i < length; i++) {
            if (f.nextBoolean() && maxNumCount > 0) {
                maxNumCount--;
                rev += numList.charAt(f.nextInt(numList.length()));
            } else {
                rev += charList.charAt(f.nextInt(charList.length()));
            }
        }
        return rev;
    }
}